package com.abei.gas.controller;

import com.abei.gas.entity.Projectorder;
import com.abei.gas.entity.Repairorder;
import com.abei.gas.service.RepairorderService;
import com.abei.gas.vo.DataVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/repairorder")
@Api(tags = "维修管理相关接口")
public class RepairorderController {
    @Autowired
    private RepairorderService repairorderService;

    @PostMapping("/insert")
    public DataVo insert(@RequestBody Repairorder repairorder) {
        repairorderService.save(repairorder);
        return DataVo.success();
    }

    @RequestMapping("/deleteById")
    public void deleteById(HttpServletRequest request){
        String id = request.getParameter("id");
        repairorderService.deleteById(id);
    }

    @RequestMapping("/update")
    public DataVo update(@RequestBody Repairorder repairorder) {
        repairorderService.updateById(repairorder);
        return DataVo.success();
    }

    @GetMapping("/findAll")
    public DataVo<Repairorder> findAll(Integer page, Integer limit){
        return repairorderService.findAll(page,limit);
    }
}
